package com.wxzz.elearing.livetelecast.api.admin;


import com.wxzz.elearing.livetelecast.dto.ActivityCategoryDto;
import com.wxzz.elearing.livetelecast.dto.WxActivityDto;
import com.wxzz.elearing.livetelecast.entity.Activity;
import com.wxzz.elearing.livetelecast.entity.ActivityCategory;
import com.wxzz.elearing.livetelecast.service.IActivityService;
import com.wxzz.elearing.livetelecast.vo.ActivityStatisticsVo;
import com.wxzz.elearning.common.vo.ReturnVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * <p>
 * 活动 前端控制器
 * </p>
 *
 * @author
 * @since 2021-04-23
 */
@Slf4j
@RestController
@RequestMapping("/activity")
@Api(tags = "活动管理(总后台)")
public class ActivityController {


    @Autowired
    private IActivityService activityService;

    @ApiOperation(value = "活动列表(总后台)", notes = "活动列表(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "listActivity", method = RequestMethod.POST)
    public ReturnVO listActivity(@RequestBody WxActivityDto wxActivityDto) {
        return activityService.listActivity(wxActivityDto);
    }

    @ApiOperation(value = "新增或修改活动(总后台)", notes = "新增或修改活动(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "saveActivity", method = RequestMethod.POST)
    public ReturnVO saveActivity(@RequestBody Activity activity) {
        return activityService.saveActivity(activity);
    }

    @ApiOperation(value = "根据活动id查询详情(总后台)", notes = "根据活动id查询详情(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "selectActivityById/{activityId}", method = RequestMethod.POST)
    public ReturnVO selectActivityById(@PathVariable Long activityId) {
        return activityService.selectActivityById(activityId);
    }

    @ApiOperation(value = "新增或修改活动分类(总后台)", notes = "新增或修改活动分类(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "saveActivityCategory", method = RequestMethod.POST)
    public ReturnVO saveActivityCategory(@RequestBody ActivityCategory activityCategory) {
        return activityService.saveActivityCategory(activityCategory);
    }

    @ApiOperation(value = "列出活动分类(总后台)", notes = "列出活动分类(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "listActivityCategory", method = RequestMethod.POST)
    public ReturnVO listActivityCategory(@RequestBody ActivityCategoryDto activityCategoryDto) {
        return activityService.listActivityCategory(activityCategoryDto);
    }


    @ApiOperation(value = "根据id删除活动分类(总后台)", notes = "根据id删除活动分类(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "deleteActivityCategoryById/{activityCategoryId}", method = RequestMethod.POST)
    public ReturnVO deleteActivityCategoryById(@PathVariable Long activityCategoryId) {
        return activityService.deleteActivityCategoryById(activityCategoryId);
    }

    @ApiOperation(value = "根据活动id查看统计数据(总后台)", notes = "根据活动id查看统计数据(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "selectActivityStatisticsVoByActivity/{activityId}", method = RequestMethod.POST)
    public ReturnVO<ActivityStatisticsVo> selectActivityStatisticsVoByActivity(@PathVariable Long activityId) {
        return activityService.selectActivityStatisticsVoByActivity(activityId);
    }

    @ApiOperation(value = "活动签到人员导入(总后台)", notes = "活动签到人员导入(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "importActivity/{activityId}", method = RequestMethod.POST)
    public ReturnVO importActivity(@RequestHeader String token, @PathVariable Long activityId, @RequestParam("file") MultipartFile file) {
        return activityService.importActivity(token, activityId, file);
    }

}
